
global test "/Users/zerenli1992/Dropbox/political_risk/data/regression"


set scheme plotplain 
destring symbol, replace
* specify panel variable
xtset symbol year



*rename pc pcc

lab var size "Size"
lab var pc_dummy  "Revolving Door"
*lab var post2012  "Post2012"
*lab var pc_post2012 "Revovling Door*Post2012"
*lab var taxpay_l "Tax"
lab var incmope_l "Revenue"
*g totlia_l = log(totlia)
lab var totlia_l "Liability"

*lab var year_sipo  "Year since IPO"
lab var npc "NPC Member"
lab var cppc "CPPCC Member"
lab var cpc "CPC Member"
*lab var tax_cut_l "Tax Cut"
lab var invinest_l "Land"
*lab var annual_return "Returns"
*lab var volatility "Volatility"

* construct interaction
*replace pc_post2012 = pc_dummy*post2012
*g pc_postpurge = pc_dummy * purge_dummy
global interaction  pc_postpurge pc_dummy purge_dummy
keep if year >= 2012

* set covariates
global covariates size  incmope_l  npc cppcc cpc  // 
global c_covariates c.size   c. c.incmope_l   c.employment_l


* generate spefic time
tabulate ind_code_res, generate(ind)

foreach var of  varlist ind1-ind18 {
	replace `var' = `var'*year
}

foreach var of  varlist ind1-ind18 {
	replace `var' = `var'*year
}


tabulate prov_code, generate(prov_trend)

foreach var of  varlist prov_trend1-prov_trend31 {
	replace `var' = `var'*year
}

* generate log dv
foreach x of varlist totlia taxpay stloan subsidy_total{
g l`x' = log(`x' +1)
}

foreach x of varlist cppcc cpc npc {
g `x'_dummy = 0
replace `x'_dummy = 1 if `x' >= 1
}
label var npc_dummy "People's Congress Member" 
label var cpc_dummy "Communist Party Member" 
label var cppcc_dummy "People's Consultative Conference Member" 

global alternativetreat npc_dummy cpc_dummy cppcc_dummy
global short_covariates   size  incmope_l 



* Purge Analysis data processing

g pc_postpurge = pc_dummy*purge_l
global purge_inter pc_postpurge pc_dummy purge_dummy purge_l  

g pc_mkt = pc_dummy*mkt_index
global purge_mkt_inter  pc_mkt pc_dummy mkt_index

label var purge_l "Purge (logged)"
label var purge_dummy "Purge (dummy)"
label var pc_postpurge " Revolving Door * Purge (logged)"

label var mkt_index "Market Development"
label var pc_mkt  "Revolving Door * Market Development"
